Optimal. Leaf size=98 \[ -\frac {a^2 x}{2}+\frac {3 a^2 \tanh ^{-1}(\cos (c+d x))}{d}-\frac {2 a^2 \cos (c+d x)}{d}-\frac {a^2 \cot ^3(c+d x)}{3 d}-\frac {a^2 \cot (c+d x) \csc (c+d x)}{d}-\frac {a^2 \cos (c+d x) \sin (c+d x)}{2 d} \]
[Out]
________________________________________________________________________________________
Rubi [A]
time = 0.12, antiderivative size = 98, normalized size of antiderivative = 1.00, number of steps
used = 12, number of rules used = 7, integrand size = 21, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.333, Rules used = {2788, 3855,
3852, 8, 3853, 2718, 2715} \begin {gather*} -\frac {2 a^2 \cos (c+d x)}{d}-\frac {a^2 \cot ^3(c+d x)}{3 d}-\frac {a^2 \sin (c+d x) \cos (c+d x)}{2 d}+\frac {3 a^2 \tanh ^{-1}(\cos (c+d x))}{d}-\frac {a^2 \cot (c+d x) \csc (c+d x)}{d}-\frac {a^2 x}{2} \end {gather*}
Antiderivative was successfully verified.
[In]
[Out]
Rule 8
Rule 2715
Rule 2718
Rule 2788
Rule 3852
Rule 3853
Rule 3855
Rubi steps
\begin {align*} \int \cot ^4(c+d x) (a+a \sin (c+d x))^2 \, dx &=\frac {\int \left (-a^6-4 a^6 \csc (c+d x)-a^6 \csc ^2(c+d x)+2 a^6 \csc ^3(c+d x)+a^6 \csc ^4(c+d x)+2 a^6 \sin (c+d x)+a^6 \sin ^2(c+d x)\right ) \, dx}{a^4}\\ &=-a^2 x-a^2 \int \csc ^2(c+d x) \, dx+a^2 \int \csc ^4(c+d x) \, dx+a^2 \int \sin ^2(c+d x) \, dx+\left (2 a^2\right ) \int \csc ^3(c+d x) \, dx+\left (2 a^2\right ) \int \sin (c+d x) \, dx-\left (4 a^2\right ) \int \csc (c+d x) \, dx\\ &=-a^2 x+\frac {4 a^2 \tanh ^{-1}(\cos (c+d x))}{d}-\frac {2 a^2 \cos (c+d x)}{d}-\frac {a^2 \cot (c+d x) \csc (c+d x)}{d}-\frac {a^2 \cos (c+d x) \sin (c+d x)}{2 d}+\frac {1}{2} a^2 \int 1 \, dx+a^2 \int \csc (c+d x) \, dx+\frac {a^2 \text {Subst}(\int 1 \, dx,x,\cot (c+d x))}{d}-\frac {a^2 \text {Subst}\left (\int \left (1+x^2\right ) \, dx,x,\cot (c+d x)\right )}{d}\\ &=-\frac {a^2 x}{2}+\frac {3 a^2 \tanh ^{-1}(\cos (c+d x))}{d}-\frac {2 a^2 \cos (c+d x)}{d}-\frac {a^2 \cot ^3(c+d x)}{3 d}-\frac {a^2 \cot (c+d x) \csc (c+d x)}{d}-\frac {a^2 \cos (c+d x) \sin (c+d x)}{2 d}\\ \end {align*}
________________________________________________________________________________________
Mathematica [A]
time = 4.23, size = 191, normalized size = 1.95 \begin {gather*} \frac {a^2 (1+\sin (c+d x))^2 \left (-12 (c+d x)-48 \cos (c+d x)+4 \cot \left (\frac {1}{2} (c+d x)\right )-6 \csc ^2\left (\frac {1}{2} (c+d x)\right )+72 \log \left (\cos \left (\frac {1}{2} (c+d x)\right )\right )-72 \log \left (\sin \left (\frac {1}{2} (c+d x)\right )\right )+6 \sec ^2\left (\frac {1}{2} (c+d x)\right )+8 \csc ^3(c+d x) \sin ^4\left (\frac {1}{2} (c+d x)\right )-\frac {1}{2} \csc ^4\left (\frac {1}{2} (c+d x)\right ) \sin (c+d x)-6 \sin (2 (c+d x))-4 \tan \left (\frac {1}{2} (c+d x)\right )\right )}{24 d \left (\cos \left (\frac {1}{2} (c+d x)\right )+\sin \left (\frac {1}{2} (c+d x)\right )\right )^4} \end {gather*}
Antiderivative was successfully verified.
[In]
[Out]
________________________________________________________________________________________
Maple [A]
time = 0.19, size = 146, normalized size = 1.49
method | result | size |
derivativedivides | \(\frac {a^{2} \left (-\frac {\left (\cot ^{3}\left (d x +c \right )\right )}{3}+\cot \left (d x +c \right )+d x +c \right )+2 a^{2} \left (-\frac {\cos ^{5}\left (d x +c \right )}{2 \sin \left (d x +c \right )^{2}}-\frac {\left (\cos ^{3}\left (d x +c \right )\right )}{2}-\frac {3 \cos \left (d x +c \right )}{2}-\frac {3 \ln \left (\csc \left (d x +c \right )-\cot \left (d x +c \right )\right )}{2}\right )+a^{2} \left (-\frac {\cos ^{5}\left (d x +c \right )}{\sin \left (d x +c \right )}-\left (\cos ^{3}\left (d x +c \right )+\frac {3 \cos \left (d x +c \right )}{2}\right ) \sin \left (d x +c \right )-\frac {3 d x}{2}-\frac {3 c}{2}\right )}{d}\) | \(146\) |
default | \(\frac {a^{2} \left (-\frac {\left (\cot ^{3}\left (d x +c \right )\right )}{3}+\cot \left (d x +c \right )+d x +c \right )+2 a^{2} \left (-\frac {\cos ^{5}\left (d x +c \right )}{2 \sin \left (d x +c \right )^{2}}-\frac {\left (\cos ^{3}\left (d x +c \right )\right )}{2}-\frac {3 \cos \left (d x +c \right )}{2}-\frac {3 \ln \left (\csc \left (d x +c \right )-\cot \left (d x +c \right )\right )}{2}\right )+a^{2} \left (-\frac {\cos ^{5}\left (d x +c \right )}{\sin \left (d x +c \right )}-\left (\cos ^{3}\left (d x +c \right )+\frac {3 \cos \left (d x +c \right )}{2}\right ) \sin \left (d x +c \right )-\frac {3 d x}{2}-\frac {3 c}{2}\right )}{d}\) | \(146\) |
risch | \(-\frac {a^{2} x}{2}+\frac {i a^{2} {\mathrm e}^{2 i \left (d x +c \right )}}{8 d}-\frac {a^{2} {\mathrm e}^{i \left (d x +c \right )}}{d}-\frac {a^{2} {\mathrm e}^{-i \left (d x +c \right )}}{d}-\frac {i a^{2} {\mathrm e}^{-2 i \left (d x +c \right )}}{8 d}+\frac {2 a^{2} \left (3 i {\mathrm e}^{4 i \left (d x +c \right )}+3 \,{\mathrm e}^{5 i \left (d x +c \right )}+i-3 \,{\mathrm e}^{i \left (d x +c \right )}\right )}{3 d \left ({\mathrm e}^{2 i \left (d x +c \right )}-1\right )^{3}}-\frac {3 a^{2} \ln \left ({\mathrm e}^{i \left (d x +c \right )}-1\right )}{d}+\frac {3 a^{2} \ln \left ({\mathrm e}^{i \left (d x +c \right )}+1\right )}{d}\) | \(176\) |
norman | \(\frac {\frac {5 a^{2} \left (\tan ^{7}\left (\frac {d x}{2}+\frac {c}{2}\right )\right )}{d}+\frac {5 a^{2} \left (\tan ^{5}\left (\frac {d x}{2}+\frac {c}{2}\right )\right )}{d}-\frac {a^{2}}{24 d}-\frac {a^{2} \tan \left (\frac {d x}{2}+\frac {c}{2}\right )}{4 d}+\frac {a^{2} \left (\tan ^{2}\left (\frac {d x}{2}+\frac {c}{2}\right )\right )}{24 d}-\frac {11 a^{2} \left (\tan ^{4}\left (\frac {d x}{2}+\frac {c}{2}\right )\right )}{12 d}+\frac {11 a^{2} \left (\tan ^{6}\left (\frac {d x}{2}+\frac {c}{2}\right )\right )}{12 d}-\frac {a^{2} \left (\tan ^{8}\left (\frac {d x}{2}+\frac {c}{2}\right )\right )}{24 d}+\frac {a^{2} \left (\tan ^{9}\left (\frac {d x}{2}+\frac {c}{2}\right )\right )}{4 d}+\frac {a^{2} \left (\tan ^{10}\left (\frac {d x}{2}+\frac {c}{2}\right )\right )}{24 d}-\frac {a^{2} x \left (\tan ^{3}\left (\frac {d x}{2}+\frac {c}{2}\right )\right )}{2}-a^{2} x \left (\tan ^{5}\left (\frac {d x}{2}+\frac {c}{2}\right )\right )-\frac {a^{2} x \left (\tan ^{7}\left (\frac {d x}{2}+\frac {c}{2}\right )\right )}{2}}{\tan \left (\frac {d x}{2}+\frac {c}{2}\right )^{3} \left (1+\tan ^{2}\left (\frac {d x}{2}+\frac {c}{2}\right )\right )^{2}}-\frac {3 a^{2} \ln \left (\tan \left (\frac {d x}{2}+\frac {c}{2}\right )\right )}{d}\) | \(276\) |
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Maxima [A]
time = 0.49, size = 139, normalized size = 1.42 \begin {gather*} -\frac {3 \, {\left (3 \, d x + 3 \, c + \frac {3 \, \tan \left (d x + c\right )^{2} + 2}{\tan \left (d x + c\right )^{3} + \tan \left (d x + c\right )}\right )} a^{2} - 2 \, {\left (3 \, d x + 3 \, c + \frac {3 \, \tan \left (d x + c\right )^{2} - 1}{\tan \left (d x + c\right )^{3}}\right )} a^{2} - 3 \, a^{2} {\left (\frac {2 \, \cos \left (d x + c\right )}{\cos \left (d x + c\right )^{2} - 1} - 4 \, \cos \left (d x + c\right ) + 3 \, \log \left (\cos \left (d x + c\right ) + 1\right ) - 3 \, \log \left (\cos \left (d x + c\right ) - 1\right )\right )}}{6 \, d} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Fricas [B] Leaf count of result is larger than twice the leaf count of optimal. 192 vs.
\(2 (92) = 184\).
time = 0.37, size = 192, normalized size = 1.96 \begin {gather*} \frac {3 \, a^{2} \cos \left (d x + c\right )^{5} - 4 \, a^{2} \cos \left (d x + c\right )^{3} + 3 \, a^{2} \cos \left (d x + c\right ) + 9 \, {\left (a^{2} \cos \left (d x + c\right )^{2} - a^{2}\right )} \log \left (\frac {1}{2} \, \cos \left (d x + c\right ) + \frac {1}{2}\right ) \sin \left (d x + c\right ) - 9 \, {\left (a^{2} \cos \left (d x + c\right )^{2} - a^{2}\right )} \log \left (-\frac {1}{2} \, \cos \left (d x + c\right ) + \frac {1}{2}\right ) \sin \left (d x + c\right ) - 3 \, {\left (a^{2} d x \cos \left (d x + c\right )^{2} + 4 \, a^{2} \cos \left (d x + c\right )^{3} - a^{2} d x - 6 \, a^{2} \cos \left (d x + c\right )\right )} \sin \left (d x + c\right )}{6 \, {\left (d \cos \left (d x + c\right )^{2} - d\right )} \sin \left (d x + c\right )} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Sympy [F(-2)]
time = 0.00, size = 0, normalized size = 0.00 \begin {gather*} \text {Exception raised: SystemError} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Giac [B] Leaf count of result is larger than twice the leaf count of optimal. 209 vs.
\(2 (92) = 184\).
time = 0.59, size = 209, normalized size = 2.13 \begin {gather*} \frac {a^{2} \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{3} + 6 \, a^{2} \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{2} - 12 \, {\left (d x + c\right )} a^{2} - 72 \, a^{2} \log \left ({\left | \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right ) \right |}\right ) - 3 \, a^{2} \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right ) + \frac {24 \, {\left (a^{2} \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{3} - 4 \, a^{2} \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{2} - a^{2} \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right ) - 4 \, a^{2}\right )}}{{\left (\tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{2} + 1\right )}^{2}} + \frac {132 \, a^{2} \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{3} + 3 \, a^{2} \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{2} - 6 \, a^{2} \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right ) - a^{2}}{\tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{3}}}{24 \, d} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Mupad [B]
time = 8.81, size = 293, normalized size = 2.99 \begin {gather*} \frac {a^2\,{\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )}^2}{4\,d}+\frac {a^2\,{\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )}^3}{24\,d}-\frac {3\,a^2\,\ln \left (\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )\right )}{d}-\frac {a^2\,\mathrm {atan}\left (\frac {a^4}{6\,a^4-a^4\,\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )}+\frac {6\,a^4\,\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )}{6\,a^4-a^4\,\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )}\right )}{d}-\frac {-9\,a^2\,{\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )}^6+34\,a^2\,{\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )}^5+\frac {19\,a^2\,{\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )}^4}{3}+36\,a^2\,{\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )}^3-\frac {a^2\,{\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )}^2}{3}+2\,a^2\,\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )+\frac {a^2}{3}}{d\,\left (8\,{\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )}^7+16\,{\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )}^5+8\,{\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )}^3\right )}-\frac {a^2\,\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )}{8\,d} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________